import 'package:flutter/material.dart';

class UiAddressbookList extends StatefulWidget {
  const UiAddressbookList({Key? key}) : super(key: key);

  @override
  _UiAddressbookListState createState() => _UiAddressbookListState();
}

class _UiAddressbookListState extends State<UiAddressbookList> {
  List<Map> items = [
    {"id": "01", "name": "张三", "icon": Icons.add},
    {"id": "02", "name": "李四", "icon": Icons.person},
    {"id": "03", "name": "王五", "icon": Icons.new_label}
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        toolbarHeight: 35,
        backgroundColor: Colors.white,
        shadowColor: Colors.transparent,
        title: const Text(
          '常用联系人',
          style: TextStyle(color: Colors.grey, fontSize: 14),
        ),
        actions: [],
      ),
      // ignore: avoid_unnecessary_containers
      body: Container(
        child: ListView.separated(
          // To add separation line between the ListView
          separatorBuilder: (context, index) =>
              Divider(color: Colors.transparent),

          itemCount: items.length,
          itemBuilder: (BuildContext context, int index) {
            return ListTile(
              leading: Icon(items[index]["icon"]),
              trailing: Text(items[index]["id"]),
              title: Text(items[index]["name"]),
            );
          },
        ),
      ),
    );
  }
}
